package cn.ncupyh.soft.staticInnerClass;

public class Outer {
    int age = 10;

    //静态内部类
    static class Inner{
        static int age = 20;

        public void method1(){
            System.out.println("method1:a = " + age);//20
        }

        public static void method2(){
            //静态内部类调用外部类成员,需要new
            Outer o = new Outer();
            System.out.println("method2:Outer.a = " + o.age);//10

            //静态方法 只能调用 静态 属性
            System.out.println("method2:Inner.a = " + age);//20
        }
    }

    public static void main(String[] args) {
        Outer.Inner oi = new Outer.Inner();
        oi.method1();
        Outer.Inner.method2();
    }
}


